using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.InteropServices;

using ILRuntime.CLR.TypeSystem;
using ILRuntime.CLR.Method;
using ILRuntime.Runtime.Enviorment;
using ILRuntime.Runtime.Intepreter;
using ILRuntime.Runtime.Stack;
using ILRuntime.Reflection;
using ILRuntime.CLR.Utils;
using System.Linq;

namespace ILRuntime.Runtime.Generated
{
    unsafe class huqiang_UIComposite_Constructor_Binding
    {
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase method;
            FieldInfo field;
            Type[] args;
            Type type = typeof(huqiang.UIComposite.Constructor);
            args = new Type[]{};
            method = type.GetMethod("Create", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Create_0);
            args = new Type[]{typeof(System.Object), typeof(System.Object), typeof(System.Int32)};
            method = type.GetMethod("Call", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Call_1);

            field = type.GetField("create", flag);
            app.RegisterCLRFieldGetter(field, get_create_0);
            app.RegisterCLRFieldSetter(field, set_create_0);
            app.RegisterCLRFieldBinding(field, CopyToStack_create_0, AssignFromStack_create_0);
            field = type.GetField("Update", flag);
            app.RegisterCLRFieldGetter(field, get_Update_1);
            app.RegisterCLRFieldSetter(field, set_Update_1);
            app.RegisterCLRFieldBinding(field, CopyToStack_Update_1, AssignFromStack_Update_1);
            field = type.GetField("reflect", flag);
            app.RegisterCLRFieldGetter(field, get_reflect_2);
            app.RegisterCLRFieldSetter(field, set_reflect_2);
            app.RegisterCLRFieldBinding(field, CopyToStack_reflect_2, AssignFromStack_reflect_2);
            field = type.GetField("initializer", flag);
            app.RegisterCLRFieldGetter(field, get_initializer_3);
            app.RegisterCLRFieldSetter(field, set_initializer_3);
            app.RegisterCLRFieldBinding(field, CopyToStack_initializer_3, AssignFromStack_initializer_3);


            app.RegisterCLRCreateDefaultInstance(type, () => new huqiang.UIComposite.Constructor());
            app.RegisterCLRCreateArrayInstance(type, s => new huqiang.UIComposite.Constructor[s]);

            args = new Type[]{};
            method = type.GetConstructor(flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Ctor_0);

        }


        static StackObject* Create_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            huqiang.UIComposite.Constructor instance_of_this_method = (huqiang.UIComposite.Constructor)typeof(huqiang.UIComposite.Constructor).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.Create();

            object obj_result_of_this_method = result_of_this_method;
            if(obj_result_of_this_method is CrossBindingAdaptorType)
            {    
                return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance, true);
            }
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method, true);
        }

        static StackObject* Call_1(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 4);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Int32 @index = ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            System.Object @dat = (System.Object)typeof(System.Object).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            System.Object @obj = (System.Object)typeof(System.Object).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 4);
            huqiang.UIComposite.Constructor instance_of_this_method = (huqiang.UIComposite.Constructor)typeof(huqiang.UIComposite.Constructor).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.Call(@obj, @dat, @index);

            return __ret;
        }


        static object get_create_0(ref object o)
        {
            return ((huqiang.UIComposite.Constructor)o).create;
        }

        static StackObject* CopyToStack_create_0(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.UIComposite.Constructor)o).create;
            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value = result_of_this_method ? 1 : 0;
            return __ret + 1;
        }

        static void set_create_0(ref object o, object v)
        {
            ((huqiang.UIComposite.Constructor)o).create = (System.Boolean)v;
        }

        static StackObject* AssignFromStack_create_0(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Boolean @create = ptr_of_this_method->Value == 1;
            ((huqiang.UIComposite.Constructor)o).create = @create;
            return ptr_of_this_method;
        }

        static object get_Update_1(ref object o)
        {
            return ((huqiang.UIComposite.Constructor)o).Update;
        }

        static StackObject* CopyToStack_Update_1(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.UIComposite.Constructor)o).Update;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_Update_1(ref object o, object v)
        {
            ((huqiang.UIComposite.Constructor)o).Update = (System.Action<System.Object, System.Object, System.Int32>)v;
        }

        static StackObject* AssignFromStack_Update_1(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Action<System.Object, System.Object, System.Int32> @Update = (System.Action<System.Object, System.Object, System.Int32>)typeof(System.Action<System.Object, System.Object, System.Int32>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)8);
            ((huqiang.UIComposite.Constructor)o).Update = @Update;
            return ptr_of_this_method;
        }

        static object get_reflect_2(ref object o)
        {
            return ((huqiang.UIComposite.Constructor)o).reflect;
        }

        static StackObject* CopyToStack_reflect_2(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.UIComposite.Constructor)o).reflect;
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_reflect_2(ref object o, object v)
        {
            ((huqiang.UIComposite.Constructor)o).reflect = (System.Func<huqiang.Core.HGUI.UIElement, System.Object>)v;
        }

        static StackObject* AssignFromStack_reflect_2(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Func<huqiang.Core.HGUI.UIElement, System.Object> @reflect = (System.Func<huqiang.Core.HGUI.UIElement, System.Object>)typeof(System.Func<huqiang.Core.HGUI.UIElement, System.Object>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)8);
            ((huqiang.UIComposite.Constructor)o).reflect = @reflect;
            return ptr_of_this_method;
        }

        static object get_initializer_3(ref object o)
        {
            return ((huqiang.UIComposite.Constructor)o).initializer;
        }

        static StackObject* CopyToStack_initializer_3(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.UIComposite.Constructor)o).initializer;
            object obj_result_of_this_method = result_of_this_method;
            if(obj_result_of_this_method is CrossBindingAdaptorType)
            {    
                return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance);
            }
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_initializer_3(ref object o, object v)
        {
            ((huqiang.UIComposite.Constructor)o).initializer = (huqiang.Core.HGUI.UIInitializer)v;
        }

        static StackObject* AssignFromStack_initializer_3(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            huqiang.Core.HGUI.UIInitializer @initializer = (huqiang.Core.HGUI.UIInitializer)typeof(huqiang.Core.HGUI.UIInitializer).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            ((huqiang.UIComposite.Constructor)o).initializer = @initializer;
            return ptr_of_this_method;
        }



        static StackObject* Ctor_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* __ret = ILIntepreter.Minus(__esp, 0);

            var result_of_this_method = new huqiang.UIComposite.Constructor();

            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }


    }
}
